class Num{
    constructor(num){
        this.num = num
        console.log('new 我了')
    }
    getNum(){
        return this.num
    }
}
const createInstance = (function(){
    let instance = null
    return function(num){
        if(!instance){
            instance = new Num(num)
        }
        return instance
    }
})()

let n1 = createInstance(1)
let n2 = createInstance(2)